const orm = require('orm');
const conf = require('../config.json')
console.log(conf.mysql.database)
const opts = {
	host: conf.mysql.host,
	password: conf.mysql.password,
	database: conf.mysql.database,
	protocol: 'mysql',
	port: conf.mysql.port,
	debug: true,
	query: {
		pool: true
	}
};

orm.connectAsync(opts)
	.then(function(db) {
		orm.db = db
	}).catch(function(err) {
		orm.err = err
		console.error('Connection error: ' + err);
	});
module.exports = orm;